var http = require('http');
var otherfun = require('./models/otherfuns.js');
http.createServer(function (request, response) {
  response.writeHead(200, {'Content-Type': 'text/html; charset=utf-8'});
  if(request.url !== '/favicon.ico') { //清除第二次访问
    //fun1(response);
    //otherfun(response);
    otherfun.fun2(response);
    otherfun['fun3'](response); //用字符串调用对应的函数
    response.end(); //不写则没有http协议尾,但是写了会产生两次访问
  }
}).listen(8000);
console.log('Server running at http://localhost:8000/');


function fun1 (res) {
  console.log('访问fun1');
  res.write("hello, 我是fun1");
}
